<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>显示单月天数</title>
</head>


<body>
    <!-- 2、输入月份，显示当月的天数（使用case 穿透简化代码）
1-12 -->
</body>
<script>
    (function () {
        let num = 2;
        let year = 2006;

        switch (num) {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                console.log('31天');
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                console.log('30天');
                break;
        }
        if (num == 2) {
            if (year % 4 == 0 && year % 100 != 0 || year % 400) console.log('29天') 
            else console.log('28天');
        }












    })();
</script>

</html>